import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import (DeclareLaunchArgument, GroupAction,
                            IncludeLaunchDescription, SetEnvironmentVariable)
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from launch_ros.actions import PushRosNamespace

def generate_launch_description():

    # 定义启动组
    sys_group = GroupAction([
        #voice_control
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(os.path.join(get_package_share_directory('voice_control'), 'launch', "voice_control.launch.py")),
            launch_arguments={'use_sim_time': LaunchConfiguration('use_sim_time'),
                                'global_parameter_file': LaunchConfiguration('global_parameter_file'),
                                'voice_parameter_file': LaunchConfiguration('voice_parameter_file'),
                                }.items()),
    ])

    ld = LaunchDescription([
        sys_group
    ])
    return ld